<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>VUE3：绑定style</title>
  </head>
  <body>
    <div id="app"></div>

    <template id="tpl">
      <!-- 绑定对象形式 -->
      <h2
        :style="{color:'red', backgroundColor:'#efefef', padding:'.25rem', border:'1px solid #333'}"
      >
        Hello, 世界
      </h2>
      <!-- 绑定数组形式 -->
      <h2
        :style="[{color:'red'}, {padding:'.25rem'}, {border:'1px solid #333', 'background-color':'#efefef'}]"
      >
        Hello, 世界
      </h2>
    </template>

    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <script>
      Vue.createApp({
        template: "#tpl",
      }).mount("#app");
    </script>
  </body>
</html>
